package com.example.logspringbootstarter.config;

import com.example.logspringbootstarter.aspect.LogAspect;
import com.example.logspringbootstarter.prop.LogProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author Senhai Xu
 */
@Configuration
@EnableConfigurationProperties(LogProperties.class)
@ConditionalOnProperty(prefix = "logging.aspect", name = "enabled", havingValue = "true", matchIfMissing = true)
@ComponentScan("com.example.logspringbootstarter")
public class LogAspectEnableAutoconfiguration {

    @Bean
    public LogAspect logAspect(){
        return new LogAspect();
    }

}
